#pragma once

#include "Vector2.h"
#include "MovableGameEntity.h"

void MovableGameEntity::SetSpeed(Vector2 s)
{
	if (s == MovableGameEntity::speed) return;

	MovableGameEntity::speed.X = s.X;
	MovableGameEntity::speed.X = s.X;
}

void MovableGameEntity::SetSpeed(float x, float y)
{
	if (x == MovableGameEntity::speed.X &&
		y == MovableGameEntity::speed.Y) return;

	MovableGameEntity::speed.X = x;
	MovableGameEntity::speed.Y = y;
}

void MovableGameEntity::SetSpeedX(float x)
{
	if (x == MovableGameEntity::speed.X) return;
	MovableGameEntity::speed.X = x;
}

void MovableGameEntity::SetSpeedY(float y)
{
	if (y == MovableGameEntity::speed.Y) return;
	MovableGameEntity::speed.Y = y;
}

void MovableGameEntity::SetDirection(Vector2 d)
{
	if (d == MovableGameEntity::direction) return;
	MovableGameEntity::direction.X = d.X;
	MovableGameEntity::direction.Y = d.Y;
}

void MovableGameEntity::SetDirection(int x, int y)
{
	if (x == MovableGameEntity::direction.X &&
		y == MovableGameEntity::direction.Y) return;
	MovableGameEntity::direction.X = x;
	MovableGameEntity::direction.Y = y;
}

void MovableGameEntity::SetDirectionX(int x)
{
	if (x == MovableGameEntity::direction.X) return;
	MovableGameEntity::direction.X = x;
}

void MovableGameEntity::SetDirectionY(int y)
{
	if (y == MovableGameEntity::direction.Y) return;
	MovableGameEntity::direction.Y = y;
}

void MovableGameEntity::Move()
{
	Vector2 newPosition = MovableGameEntity::GetPosition() + (MovableGameEntity::speed * MovableGameEntity::direction);
	MovableGameEntity::SetPosition(newPosition);
}

bool MovableGameEntity::IsMoving()
{
	return MovableGameEntity::direction.X != 0 && MovableGameEntity::direction.Y != 0;
}